<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var n = 10;
        // var res = n.toFixed(3)    //保留三位小数,保留出来的结果是一个字符串
        // console.log(typeof res);



        // var n = 3.0000
        var n = Math.PI
        var res = n.toFixed(8)
        console.log(res);
    </script>
</body>
</html>